// hyb_yl/onesubpages/pages/shopdetail/shopdetail.js
var wxParse = require("../../../../utils/wxParse.js")
var thro = require("../../../../utils/throttle.js")
var app = getApp()
Page({

  /**
   * 页面的初始数据
   */
  data: {
    buttonClicked: false,
    bigmoney: '', //最大的价格
    smallmoney: '', //最小的价格
    lunbo: [
      '/assets/images/medimg.jpg'
    ],
    collect: false,
    instructions: [{
      title: "药品类型",
      name: "中成药",
      img: "/assets/images/yao.png"
    },
    {
      title: "批准文号",
      name: "国药准字z37021368",
      img: "/assets/images/yao.png"
    },
    {
      title: "药品类型",
      name: "东阿阿胶股份有限公司",
      img: "/assets/images/yao.png"
    },
    {
      title: "药品类型",
      name: "阿胶",
      img: "/assets/images/yao.png"
    },
    {
      title: "药品类型",
      name: "一日一次",
      img: "/assets/images/yao.png"
    },
    {
      title: "药品类型",
      name: "血虚，眩晕心悸，心烦不眠，肥皂可造",
      img: "/assets/images/yao.png"
    },
    {
      title: "药品类型",
      name: "本品为补血滋阴制剂，性质粘腻，饭脾胃虚弱者，食入难消",
      img: "/assets/images/yao.png"
    },
    {
      title: "药品类型",
      name: "本品为补血滋阴制剂，性质粘腻，饭脾胃虚弱者，食入难消",
      img: "/assets/images/yao.png"
    },
    {
      title: "药品类型",
      name: "本品为补血滋阴制剂，性质粘腻，饭脾胃虚弱者，食入难消",
      img: "/assets/images/yao.png"
    },
    ],
    parameter: true, //商品参数

    // 优惠券
    sale: true,
    cash: [{
      id: 0,
      intro: "仅可购买京东健康自营药房慢病用药部分商品",
      startTime: "2019-11-2",
      over: "2019-11-7",
      full: 159,
      subtract: 10,
      statu: 0, //判断已领取和未领取的状态
      usable: 0, //判断可用和不可用的状态
    },
    {
      id: 1,
      intro: "仅可购买京东健康自营药房慢病用药部分商品",
      startTime: "2019-11-2",
      over: "2019-11-11",
      full: 264,
      subtract: 50,
      statu: 0, //判断已领取和未领取的状态
      usable: 0, //判断可用和不可用的状态
    }
    ],
    choseprod: true, //已选的遮罩
    // choserul: ['金水宝胶囊72粒装 升级新包装', '30周年礼盒装 90粒*3小盒', '六味地黄滴丸 60丸', '六味地黄滴丸 60丸'],
    chosekey: 0,
    num: 1,
    price: '',
    img: '',
    gg_ke: '',
    gg_bh: '',
    drugName: '',
    arr: [],
    // 评价
    appraise: [{
      headimg: '/assets/images/head.png',
      name: 'MckennaGrace',
      starNum: 5,
      time: '2019 - 06 - 26',
      sign_text: '非常棒，每次都在京东购买这些必需品，真的太好了都不晓得说什么了，总之就是好',
      medio_img: '/assets/images/medimg.jpg'
    },
    {
      headimg: '/assets/images/head.png',
      name: 'MckennaGrace',
      starNum: 5,
      time: '2019 - 06 - 26',
      sign_text: '非常棒，每次都在京东购买这些必需品，真的太好了都不晓得说什么了，总之就是好',
      medio_img: ''
    },

    ],
   
   
    tabkey: 0,
    amount:0,
    amountShop:0,
  },
  askdoctor:function(){
    wx.navigateTo({
      url: '/hyb_yl/mysubpages/pages/askdoctor/askdoctor',
    })
  },
  // 购物车
  shopcar:function(){
    var ifcfy = this.data.ifcfy
    wx.navigateTo({
      url:"/hyb_yl/mysubpages/pages/shopList/shopList?ifcfy="+ifcfy
    })
  },
  // 药品清单列表
  drugbtn:function(){
    var ifcfy = this.data.ifcfy
    console.log(ifcfy)
    wx.navigateTo({
      url: '/hyb_yl/mysubpages/pages/druglist/druglist?ifcfy=' + ifcfy,
    })
  },
  // 点击收藏
  collectbtn: function () {
    this.setData({
      collect: !this.data.collect
    })
    if (this.data.collect == true) {
      wx.showToast({
        title: '收藏成功',
        icon: 'none'
      })
    } else {
      wx.showToast({
        title: '取消成功',
        icon: 'none'
      })
    }
  },
  // 打开商品参数
  commodity: function () {
    this.setData({
      parameter: false
    })
  },
  closepara: function () {
    this.setData({
      parameter: true
    })
  },
  move: function () { },
  // 打开优惠券
  discounts: function () {


    this.setData({
      sale: false
    })

  },
  //关闭优惠券
  closedisc: function () {
    this.setData({
      sale: true
    })
  },
  btnget: function (e) {
    console.log(e)
    var index = e.currentTarget.dataset.index
    var cash = this.data.cash;
    cash[index].statu = 1
    var already = []
    this.setData({
      cash: cash
    })
    console.log(this.data.cash)
    for (var i = 0; i < cash.length; i++) {
      if (cash[i].statu == 1) {
        already.push(cash[i])
      }
    }
    this.setData({
      already: already
    })
    var cash = wx.getStorageSync("cash") || []
    // cash = this.data.cash
    var already = wx.getStorageSync("coupon") || []
    already = this.data.already;
    wx.setStorageSync("coupon", this.data.already)
    cash = this.data.cash
    console.log(cash)
    wx.setStorageSync("cash", cash)
  },
  //关闭立即购买 
  chose_clo: function () {
    this.setData({
      choseprod: true
    })
  },
  // 打开立即购买
  popchoose: function () {
    var guige = []
    var chosekey = this.data.chosekey;
    var proList = this.data.proList;
    console.log(proList.item.guige)
    guige = proList.item.guige
    console.log(guige)
    console.log(guige[chosekey].gg_id)
    this.setData({
      choseprod: false,
      img: guige[chosekey].gg_thumb,
      price: guige[chosekey].gg_money,
      drugName: guige[chosekey].gg_name,
      gg_ke: guige[chosekey].gg_ke,
      gg_bh: guige[chosekey].gg_bh,
      gg_id: guige[chosekey].gg_id
    })
  },
  closeprod: function () {
    this.setData({
      choseprod: true,

    })
  },
  num: function (e) {
    console.log(e)

    this.setData({
      num: e.detail.value
    })

    console.log(this.data.num)
  },
  getnum: function (e) {
    if (this.data.num < 1) {
      wx.showToast({
        title: '至少输入一个商品',
        icon: 'none'
      })
      this.setData({
        num: 1
      })
    }
    var list= this.data.proList.item
    if(this.data.num == this.data.mostgt){
      if(this.data.num > list.snum){
        wx.showToast({
          title: '商品不能超过'+list.snum+'个',
          icon: 'none'
        })
        this.setData({
          num: list.snum
        })
      }
    }else{
      if(this.data.num > this.data.mostgt){
        wx.showToast({
          title: '商品不能超过'+this.data.mostgt+'个',
          icon: 'none'
        })
        this.setData({
          num: this.data.mostgt
        })
      }
    }
  },
  // 选择规格
  choserul: function (e) {
    console.log(e)
    var proList = this.data.proList;
    var gg_name = e.currentTarget.dataset.gg_name
    var item = e.currentTarget.dataset.item
    var price = this.data.price
    var gg_id = item.gg_id
    proList.item.smoney = item.gg_money
    price = item.gg_money
    var drugName = item.gg_name
    this.setData({
      chosekey: e.currentTarget.dataset.index,
      price: price,
      drugName: drugName,
      img: item.gg_thumb,
      gg_ke: item.gg_ke,
      gg_bh: item.gg_bh,
      proList: proList,
      gg_name: gg_name,
      gg_id: gg_id
    })
    console.log(proList)
  },
  // 点击图片放大
  preview: function (e) {
    console.log(e)
    var imgArr = []
    imgArr[0] = e.currentTarget.dataset.img
    var currentUrl = e.currentTarget.dataset.img
    wx.previewImage({
      current: currentUrl, // 当前显示图片的http链接
      urls: imgArr // 需要预览的图片http链接列表
    })
  },
  // 详情点击图片放大
  imgbtn:function(e){
    console.log(e)
    var appraise = this.data.appraise
    var index = e.currentTarget.dataset.index
    console.log(appraise)
    var img = e.currentTarget.dataset.item
    wx.previewImage({
      current: img, // 当前显示图片的http链接
      urls: appraise[index].pl_text.pic // 需要预览的图片http链接列表
    })
  },
  // 加入药品清单
  addlist: function () {
    let list_num = this.data.list_num
    list_num++
    this.setData({
      list_num
    })
  },
  goTop: function (e) { // 一键回到顶部
    if (wx.pageScrollTo) {
      wx.pageScrollTo({
        scrollTop: 0
      })
    } else {
      wx.showModal({
        title: '提示',
        content: '当前微信版本过低，无法使用该功能，请升级到最新微信版本后重试。'
      })
    }
  },
  bindMinus: function () {
    // var t = this.data.num;
    var num = this.data.num;
    num--;
    if (num < 1) {
      wx.showToast({
        title: '至少一件商品',
        icon: 'none'
      })
    } else {
      this.setData({
        num: num
      })
    }

    // var price = this.data.price;
    // console.log(price),
    //   t <= 1 ? wx.showToast({
    //     title: "至少一件商品",
    //     icon: "none",
    //     duration: 1e3
    //   }) : (t--, price = price - 68, this.setData({
    //     num: t,
    //     price: price
    //   }));
  },
  bindPlus: function () {
    var num = this.data.num;
    num++;
    this.setData({
      num: num
    })
    if(this.data.num > this.data.mostgt){
      wx.showToast({
        title: '商品不能超过200个',
        icon: 'none'
      })
      this.setData({
        num: this.data.mostgt
      })
    }
    console.log(this.data.num)
    // var price = this.data.price;
    // t++, price = price + 68, this.setData({
    //   num: t,
    //   price: price
    // });
  },
  // 加入药品清单
  addlist: function () {
    let list_num = this.data.list_num
    list_num++
    this.setData({
      list_num
    })
  },
  //加入购物车
  addcar:function(e){
    console.log(e)
    var num = this.data.num
    console.log(num)
    var chosekey = this.data.chosekey
    var list= this.data.proList.item
    var ifcfy = this.data.ifcfy
    var g_kuaidi = this.data.g_kuaidi
    var gg_name = this.data.drugName
    var num = this.data.num;
    var mostgt = this.data.mostgt
    var gg_ke = this.data.gg_ke
    var gg_id = this.data.gg_id
    var addressid = this.data.addressid //收货地址id
    console.log(list)
    var shopList={
      sid: list.sid,
      sname: list.sname,
      sthumb: list.sthumb,
      snum: list.snum,
      num: this.data.num,
      smoney: list.smoney,
      g_kuaidi: g_kuaidi,
      gg_name: gg_name,
      mostgt: mostgt,
      gg_ke: gg_ke,
      ifcfy: ifcfy,
      gg_id: gg_id,
      addressid: addressid
    }
    console.log(shopList)
    var shopcar = wx.getStorageSync('shopcar') || []
    var amountShop = this.data.amountShop
    if(shopcar.length>0){
      for(var i in shopcar){
        if(shopcar[i].sid == shopList.sid){
          if(shopcar[i].gg_id == shopList.gg_id){
            shopcar[i].num = shopcar[i].num+shopList.num
            console.log(shopcar[i].num)
            if(shopcar[i].mostgt == 0){
              if(shopcar[i].num > shopcar[i].snum){
                shopcar[i].num = shopcar[i].snum
                try{
                  wx.setStorageSync('shopcar', shopcar)
                  amountShop = amountShop
                  console.log(shopcar,"4444444444444444")
                  this.setData({
                    // amountShop:amountShop,
                    num:1
                  })
                } catch (e) {
                  console.log(e)
                }
                wx.showToast({
                  title: '加入购物车成功！',
                  icon: 'success',
                  duration: 2000
                });
                return;
              }
            }else{
              if(shopcar[i].num > shopcar[i].mostgt){
                shopcar[i].num = shopcar[i].mostgt
                try{
                  wx.setStorageSync('shopcar', shopcar)
                  console.log(shopcar)
                  amountShop = amountShop
                  // amountShop =amountShop + shopList.num
                // console.log(amountShop)
                  this.setData({
                    // amountShop:amountShop,
                    num:1
                  })
                } catch (e) {
                  console.log(e)
                }
                wx.showToast({
                  title: '加入购物车成功！',
                  icon: 'success',
                  duration: 2000
                });
                return;
              }
              
            }
            try{
              wx.setStorageSync('shopcar', shopcar)
              amountShop =amountShop + shopList.num
            console.log(amountShop)
              this.setData({
                amountShop:amountShop,
                num:1
              })
            } catch (e) {
              console.log(e)
            }
            wx.showToast({
              title: '加入购物车成功！',
              icon: 'success',
              duration: 2000
            });
         
            // 返回（在if内使用return，跳出循环节约运算，节约性能） 
            return;
          }
        }   
      }
      shopcar.push(shopList)
      amountShop =amountShop + shopList.num
      this.setData({
        amountShop:amountShop,
        num:1
      })
    }else{
      shopcar.push(shopList)
      amountShop =amountShop + shopList.num
      this.setData({
        amountShop:amountShop,
        num:1
      })
    }
    try {
      wx.setStorageSync('shopcar', shopcar)
      // 返回（在if内使用return，跳出循环节约运算，节约性能） 
      //关闭窗口
      wx.showToast({
        title: '加入购物车成功！',
        icon: 'success',
        duration: 2000
      });
      this.setData({
          choseprod: true
        })
      return;
    } catch (e) {
      console.log(e)
    }
},
//加入药品清单
addDruglist:function(e){
    console.log(e)
    var num = this.data.num
    console.log(num)
    var chosekey = this.data.chosekey
    var list= this.data.proList.item
    var ifcfy = this.data.ifcfy
    var g_kuaidi = this.data.g_kuaidi
    var gg_name = e.currentTarget.dataset.drugname
    var num = this.data.num;
    var mostgt = this.data.mostgt
    var gg_ke = this.data.gg_ke
    var gg_id = this.data.gg_id
    
    var addressid = this.data.addressid //收货地址id
    console.log(list)
    var shopList={
      sid: list.sid,
      sname: list.sname,
      sthumb: list.sthumb,
      snum: list.snum,
      num: this.data.num,
      smoney: list.smoney,
      g_kuaidi: g_kuaidi,
      gg_name: gg_name,
      mostgt: mostgt,
      gg_ke: gg_ke,
      ifcfy: ifcfy,
      gg_id: gg_id,
      addressid: addressid
    }
    console.log(shopList)
    var druglist = wx.getStorageSync('druglist') || []
    var amount = this.data.amount
    if(druglist.length >0){
      for(var i  in druglist){
        if(druglist[i].sid == shopList.sid){
          if(druglist[i].gg_id == shopList.gg_id){
            druglist[i].num = parseFloat(druglist[i].num)+parseFloat(shopList.num)
            if(druglist[i].mostgt == 0){
              if(druglist[i].num > druglist[i].snum){
                druglist[i].num = druglist[i].snum
                try{
                  wx.setStorageSync('druglist', druglist)
                  amount =amount
                  this.setData({
                    amount:amount,
                    num:1
                  })
                } catch (e) {
                  console.log(e)
                }
                wx.showToast({
                  title: '加入药品清单成功',
                  icon: 'success',
                  duration: 2000
                });
                this.chose_clo()
                // 返回（在if内使用return，跳出循环节约运算，节约性能） 
                return;
              }
            }else{
              if(druglist[i].num > druglist[i].mostgt){
                druglist[i].num = druglist[i].mostgt
                try{
                  wx.setStorageSync('druglist', druglist)
                  console.log(druglist)
                  amount =amount
                  this.setData({
                    amount:amount,
                    num:1
                  })
                } catch (e) {
                  console.log(e)
                }
                wx.showToast({
                  title: '加入药品清单成功',
                  icon: 'success',
                  duration: 2000
                });
                this.chose_clo()
                // 返回（在if内使用return，跳出循环节约运算，节约性能） 
                return;
              }
            }
            try{
              wx.setStorageSync('druglist', druglist)
              amount =amount + shopList.num
              this.setData({
                amount:amount,
                num:1
              })
            } catch (e) {
              console.log(e)
            }
            wx.showToast({
              title: '加入药品清单成功',
              icon: 'success',
              duration: 2000
            });
            this.chose_clo()
            // 返回（在if内使用return，跳出循环节约运算，节约性能） 
            return;
          }
        }
      }
      amount =amount + shopList.num
      this.setData({
        amount:amount,
        num:1
      })
      console.log(amount)
      druglist.push(shopList)
    }else{
      amount =amount + shopList.num
      this.setData({
        amount:amount,
        num:1
      })
      this.chose_clo()
      // console.log(amount)
      druglist.push(shopList)
    }
    
    try {
      console.log("1111111111111")
      wx.setStorageSync('druglist', druglist)
      // 返回（在if内使用return，跳出循环节约运算，节约性能） 
      //关闭窗口
      wx.showToast({
        title: '加入药品清单成功',
        icon: 'success',
        duration: 2000
      });
      this.setData({
        choseprod: true
      }) 
      return;
    } catch (e) {
      console.log(e)
    }
  },
  
  tap: function (e) {
    console.log(this.data.nodes)
    // let reg = /(?<=(src="))[^"]*?(?=")/ig
    let reg = new RegExp('(?<=(src="))[^ "]*?(?=")')
    let allSrc = this.data.nodes.match(reg)
    var img = allSrc[0]
    console.log(img)
    var arr = [];
    arr[0] = img
    console.log(arr)
    console.log(allSrc)
    wx.previewImage({
      current: img, // 当前显示图片的http链接
      urls: arr // 需要预览的图片http链接列表
    })
  },
  shopNow: function (e) {
    console.log(e)
    var price = e.currentTarget.dataset.smoney
    var that = this
    var list = that.data.proList.item
    console.log(that.data.ifcfy)
    var ifcfy = that.data.ifcfy
    var g_kuaidi = that.data.g_kuaidi
    var gg_name = that.data.drugName
    var num = that.data.num;
    var mostgt = that.data.mostgt
    var gg_ke = that.data.gg_ke
    var gg_id = that.data.gg_id
    var addressid = that.data.addressid //收货地址id
    that.setData({
      choseprod: true
    })
    var newarr=[]
    //商品id 缩略图 数量 地址 优惠券金额 优惠券id 商品名称
    var list ={
      sid: list.sid,
      sname: list.sname,
      sthumb: list.sthumb,
      snum: list.snum,
      num: that.data.num,
      smoney: list.smoney,
      g_kuaidi: g_kuaidi,
      gg_name: gg_name,
      mostgt: mostgt,
      gg_ke: gg_ke,
      ifcfy: ifcfy,
      gg_id: gg_id,
      addressid: addressid
    }
    newarr.push(list)
    // var newarr = JSON.stringify({
    //   sid: list.sid,
    //   sname: list.sname,
    //   sthumb: list.sthumb,
    //   snum: list.snum,
    //   num: that.data.num,
    //   smoney: list.smoney,
    //   g_kuaidi: g_kuaidi,
    //   gg_name: gg_name,
    //   mostgt: mostgt,
    //   gg_ke: gg_ke,
    //   ifcfy: ifcfy,
    //   gg_id: gg_id,
    //   addressid: addressid
    // })\
    that.setData({
      num:1
    })
    console.log(newarr)
    wx.navigateTo({
      url: '/hyb_yl/mysubpages/pages/shopdetail/shopdetail?arr=' + JSON.stringify(newarr) + '&ifcfy='+ ifcfy
    })
   
  },
  // 商品介绍详情
  tabdian: function (e) {
    console.log(e.currentTarget.dataset.index)
    this.setData({
      tabkey: e.currentTarget.dataset.index
    })

  },
  // 选择微信收货地址
  wxaddress: function () {
    thro.buttonClicked(this);
    var region = [];
    var arr1 = [];
    var that = this
    wx.chooseAddress({
      success: function (res) {
        console.log(JSON.stringify(res))
        var name = res.userName
        var phone = res.telNumber
        region.push(res.provinceName, res.cityName, res.countyName)
        var address = res.detailInfo
        var addlist = {
          name: res.userName,
          phone: res.telNumber,
          address: res.detailInfo,
          region: region,
          label: -1,
          addlabel: ""
        }
        console.log(addlist)
        //添加收货人信息
        var userName = addlist.name
        var userPhone = addlist.phone
        var userAddress = addlist.region[0] + '-' + addlist.region[1] + '-' + addlist.region[2] + '-' + addlist.address
        app.util.request({
          'url': 'entry/wxapp/Goods.creatuseraddress',
          data: {
            openid: wx.getStorageSync('openid'),
            userName: userName,
            userPhone: userPhone,
            userAddress: userAddress
          },
          success: function (res) {
            console.log(res)
            wx.setStorageSync("Address", res.data)
            that.setData({
              addressid: res.data.addressId,
              addresslist: res.data
            })
          }
        })
        arr1 = wx.getStorageSync("Address") || [];
        that.setData({
          addresslist: arr1
        })
      },
    })
  },
  getAllpinglun: function () {
    var that = this
    var sid = that.data.sid
    app.util.request({
      'url': 'entry/wxapp/Goods.pinglun',
      data: {
        sid: sid
      },
      success: function (res) {
        console.log(res)
        that.setData({
          appraise: res.data
        })
      }
    })
  },

  getamount(){
    var amount = 0;
    var druglist = wx.getStorageSync('druglist')
    for(var i=0;i<druglist.length;i++){
      amount=parseFloat(amount)+ parseFloat(druglist[i].num)
    }
    console.log(amount)
    this.setData({
      amount:amount
    })
  },
  amountShop(){
    var amountShop = 0;
    var shopcar = wx.getStorageSync('shopcar')
    for(var i=0;i<shopcar.length;i++){
      amountShop= parseFloat(amountShop)+parseFloat(shopcar[i].num)
    }
    this.setData({
      amountShop:amountShop
    })
  },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
   
    // this.getamount()
    var bgc = wx.getStorageSync('color')
    wx.setNavigationBarColor({
      frontColor: "#ffffff",
      backgroundColor: bgc,
    })
    var openid = wx.getStorageSync('openid')
    if (openid) {
      this.setData({
        isAuthor: true
      })
    } else {
      this.setData({
        isAuthor: false
      })
    }
    var that = this;
    var sid = options.sid
    that.setData({
      sid: sid,
    })
    var cash = wx.getStorageSync("cash") || []
    wx.setStorageSync("cash", this.data.cash)
    that.setData({
      cash: cash
    })
    var arr1 = wx.getStorageSync("Address") || [];
    that.setData({
      addresslist: arr1
    })
    that.getGoodshoping(sid)
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {
    this.getAllpinglun()
    this.getAllyjq()
  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {
    var cash = wx.getStorageSync("cash") || []
    wx.setStorageSync("cash", this.data.cash)
    this.setData({
      cash: cash
    })
    this.getamount()
    this.amountShop()
  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },



  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  getGoodshoping: function (sid) {
    var that = this
    var chosekey = that.data.chosekey
    app.util.request({
      'url': 'entry/wxapp/Goods.detail',
      data: {
        sid: sid
      },
      success: function (res) {
        console.log(res)
        var guige = res.data.item.guige
        var scontent = res.data.contents
        var g_kuaidi = res.data.item.g_kuaidi
        var mostgt = res.data.item.mostgt
        wxParse.wxParse('scontent', 'html', res.data.contents, that, 5)
        if (guige.length!=0){
          that.setData({
            gg_ke: guige[chosekey].gg_ke,
            smallmoney: guige[chosekey].gg_money,
            gg_id :guige[chosekey].gg_id
          })
          for (var i = 0; i < guige.length; i++) {
            for (var j = 0; j < guige.length - i; j++) {
              if (guige[i].gg_money > guige[j].gg_money) {
                that.setData({
                  bigmoney: guige[i].gg_money,
                  drugName: guige[j].gg_name,
                })
              }
            }
          }
        }else{
          that.setData({
            drugName: res.data.item.sname,
          })
        }
        that.setData({
          proList: res.data,
          nodes: scontent,
         
          g_kuaidi: g_kuaidi,
          mostgt: mostgt,
          ifcfy: res.data.item.ifcfy
        })
        var proList = that.data.proList


      }
    })

  },
  getAllyjq() {
    var that = this
    app.util.request({
      'url': 'entry/wxapp/Goods.yhuq',
      success: function (res) {
        console.log(res)
        that.setData({
          yhq: res.data
        })
      }
    })
  },
  //评价详情
  evaldetail: function (e) {
    var that= this
    var pl_id = e.currentTarget.dataset.pl_id
    wx.navigateTo({
      url: '/hyb_yl/mysubpages/pages/commevaldetail/commevaldetail?pl_id=' + pl_id,
    })
  },
  eval: function () {
    var sid = this.data.sid
    wx.navigateTo({
      url: '/hyb_yl/mysubpages/pages/allevalation/allevalation?sid=' +sid,
    })
  },
})